import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQml 2.12

Item
{
    property alias list: girdRepeater.model
    Grid
    {
        id:girdLayout
        anchors.fill: parent
        columns: 3

        Repeater
        {
            id:girdRepeater
            Frame
            {
                padding: 5
                width: parent.width*0.3
                height: parent.height*0.1
                background: Rectangle
                {
                    id:background
                    color:"#00000000"
                    radius:5
                }
                clip: true

                MusicBorderImage
                {
                    id:img
                    height: parent.height
                    width: parent.width*0.3
                    imgSrc: modelData.album.picUrl
                }

                Text
                {
                    id:name
                    anchors
                    {
                        top:parent.top
                        left:img.right
                        //verticalCenter:parent.verticalCenter
                        bottomMargin:10
                        leftMargin:5
                        //centerIn:parent.Center
                    }
                    text: modelData.album.name
                    font.family: window.m_FONT_FAMLIY
                    height: 30
                    font.pointSize: 11
                    width: parent.width*0.72
                    elide: Qt.ElideMiddle
                    color: "#eeffffff"
                }

                Text
                {
                    anchors
                    {
                        left:img.right
                        top:name.bottom
                        leftMargin:5
                    }
                    text: modelData.artists[0].name
                    font.family: window.m_FONT_FAMLIY
                    height: 30
                    width: parent.width*0.72
                    elide: Qt.ElideMiddle
                    color: "#eeffffff"
                }

                MouseArea
                {
                    anchors.fill: parent
                    hoverEnabled: true
                    cursorShape: Qt.PointingHandCursor
                    onEntered:
                    {
                        background.color = "#50ffffff"
                    }
                    onExited:
                    {
                        background.color = "#00000000"
                    }
                    onClicked:
                    {
                        layoutBottomView.current = -1
                        layoutBottomView.playList = [{
                                                         id:list[index].id,
                                                         name:list[index].name,
                                                         artist:list[index].artists[0].name,
                                                         album:list[index].album.name,
                                                         cover:list[index].album.picUrl,
                                                         type:"0"
                                                     }]
                        layoutBottomView.current = 0

                    }
                }
            }
        }
    }
}
